package com.casic.ops.entity.dto.pipeline.datastructure.loader;

import com.casic.ops.runner.pipeline.node.ExecutableNode;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 流水线节点执行类加载器，只要实现了Executable接口的类都是节点执行类，
 * @author cww
 * @date 2022/6/17
 */
@Service
public class
PipelineNodeLoader implements Loader<String, ExecutableNode> {

    @Resource
    private ApplicationContext applicationContext;

    @Override
    public ExecutableNode load() {
        return null;
    }

    @Override
    public ExecutableNode load(String key) {
        return null;
    }

    @Override
    public List<ExecutableNode> loadAll() {
        return applicationContext.getBeansOfType(ExecutableNode.class).values().stream().collect(Collectors.toList());
    }

    @Override
    public List<ExecutableNode> loadAll(List<String> keys) {
        return null;
    }
}
